#!/usr/bin/env node

const Koa=require("koa");

const app=new Koa();

//M-logger和M-ms的功能合二为一
app.use((ctx,next)=>{
  const start=Date.now();
  next();
  const end=Date.now();
  console.log(`${ctx.method} ${ctx.path} - ${end-start}ms`);
});

//M-hello
app.use((ctx,next)=>{
  ctx.body='hello world';
})
app.listen(8080);

console.log('hello koa2!');





